// file name: disjoint-set.cpp
// description: a cpp file that implements disjoint set
// last editor: sunist chan
// macOS Catalina 10.15.5 with Visual Studio Code and GCC11
// complie command: g++ disjoint-set.cpp -o YOUR_PROGRAM_NAME

#include <iostream>

using namespace std;

class edge
{
    public:
    int nodeA_index;
    int nodeB_index;
};

int root(int index, int *parents)
{
    int root = index;
    while (parents[root] != -1)
    {
        root = parents[root];
    }
    return root;
}

bool set_union(int x, int y, int *parents)
{
    int x_root = root(x, parents);
    int y_root = root(y, parents);
    if (x_root == y_root)
    {
        return false;
    }
    else
    {
        parents[x_root] = y_root;
        return true;
    }
}

bool disjoint(edge* edges, int edge_count, int *parents, int parent_count)
{
    for (int i = 0; i < edge_count; i++)
    {
        if (!set_union(edges[i].nodeA_index, edges[i].nodeB_index, parents))
        {
            return true;
        }
    }
    return false;
}

int main()
{
    int node_count, edge_count;
    std::cin >> node_count >> edge_count;
    int *nodeParents = new int[node_count];
    
    for (int i = 0; i <node_count; i++)
    {
        nodeParents[i] = -1;
    }
    
    edge *edges = new edge[edge_count];

    for (int i = 0; i < edge_count; i++)
    {
        std::cin >> edges[i].nodeA_index >> edges[i].nodeB_index;
    }

    if (disjoint(edges, edge_count, nodeParents, node_count))
    {
        std::cout << "TRUE\n";
    }
    else
    {
        std::cout << "FALSE\n";
    }

    return 0;
}